<%-- 
    Document   : formDescriptForm
    Created on : 19 juin 2013, 14:42:06
    Author     : ali
--%>

<%@page import="EDT.obj.Formation"%>
<%@page import="java.util.ArrayList"%>

  <%@ pageimport = "org.w3c.dom.*"%>

<%@page contentType="text/html" pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
                
        <title>Emplois du temps promo form</title>
            <link rel="stylesheet" href="Accueil.css" />
            <link rel="SHORTCUT ICON" href="./edt.jpg" />
            
               
            <script language="JavaScript">
                                
               function getNbGp(idp){
               var idpromo = idp.value;
               var nbGp = document.getElementById(idpromo).value;
                var select = document.createElement('select');
                select.setAttribute("name", "groupe");
                select.setAttribute("id", "groupe");
                var option;
                //alert(nbGp);
                var i=1;
                while (i<= nbGp)
                {
                    option = document.createElement('option');
                    option.setAttribute("value", i);
                    option.appendChild(document.createTextNode(i));
                    select.appendChild(option);
                    i++;
                }
                //document.getElementById('grp').removeChild("groupe");
                document.getElementById('grp').replaceChild(select, document.getElementById('groupe'));
                //document.getElementById('grp').removeChild(document.getElementById('groupe'));
                //document.getElementById('grp').appendChild(select);
                //document.getElementById("grp") = select;
                
        //document.appendChild(select);
                
               }

         </script>
    </head>
    <body>
        
     
    
         
    <section>
      
    <% 
    String form ="";
    ArrayList<Formation> formation = EDT.api.API.getFormation();
    
        
        form += "<form method='POST' action='/EDT/DescriptFormAct.do' target='section'>";
        form += "<div class='commentaire'>";
        form += "<fieldset>";
        
        
        form +="<legend>    Choisissez une formation  :   </legend>";
        form +="Formation : <select name='formation'>";
        for (Formation f : formation)
        form +="    <option value='"+f.getId()+"'>"+f.getNom()+"</option>";
        form +="</select><br/><br/>";
        
  
        form +="<input type='submit' value='valider'/><br/>";
        out.println(form);
            
    %>

    <html:errors/> 
    
    </fieldset>
    
        
    </div>
        
    
        
    </form>
        
        
        
        
    </section>
    </body>
</html>
